<template>
	<view class="top-15 bottom-15">
		<view class="houseItem" v-for="(item, index) in list"  :key="index">
			<view class="houseTitle flex" @click="toHouseDetail(item)">
				<view class="leftLogo">
					<image :src="item.image_list[0].url" mode="aspectFill"></image>
				</view>
				<view class="rightTitle flex">
					<view class="nameBox flex">
						<view class="title">{{item.product_title}}</view>
						<view>
							<text class="item">视频看房</text>
						</view>
					</view>
					<view class="priceBox">
						<block v-if="item.price">
							<text class="price"><text class="fontNum">{{item.price && item.price !== '0' ? item.price : '--'}}</text>元/m²</text>
							<text class="line">|</text>
						</block>
						<block v-else-if="item.amount">
							<text class="price fontNum">{{item.amount}}</text>
							<text class="line">|</text>
						</block>
						<text class="area">{{item.area}}</text>
						<text class="jiedao" v-if="item.street">{{item.street}}</text>
					</view>
				</view>
			</view>
			<view class="houseType">
				{{item.title}}
			</view>
			<view class="videoImg">
				<image :src="item.image.length > 0 ? item.image[0].url : item.image_list[0].url" mode="scaleToFill"></image>
				<view class="item flex" @click="toPlayVideo(item)">
					<!-- #ifdef MP-WEIXIN || MP-TOUTIAO -->
					<text class="ipang-video"></text>
					<!-- #endif -->
					<!-- #ifdef MP-BAIDU -->
					<u-icon name="play-circle" color="#FFFFFF" size="106"></u-icon>
					<!-- #endif -->
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import { mapState } from 'pinia';
	import { useConfigStore } from '@/store/index';
	export default {
		data() {
			return {
			}
		},
		props: {
			list: {
				value: Array,
				default: []
			}
		},
        computed:{
        	...mapState(useConfigStore, ['puid'])
        },
		
		methods: {
			//to楼盘详情
			toHouseDetail(item){
				uni.navigateTo({
					url: `/pages/product/detail/index?productId=${item.product}&puid=${this.puid}&title=${item.product_title}`
				})
			},
			//跳转播放页面
			toPlayVideo(info){
				uni.navigateTo({
					url: `/pages/product/video/play?videoId=${info.id}&productId=${info.product}&puid=${this.puid}&title=${info.title}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.houseItem{
		margin-bottom: 60rpx;
		video{
			width: 670rpx;
			height: 378.5rpx;
		}
		.houseTitle{
			.leftLogo{
				width: 90rpx;
				height: 90rpx;
				border-radius: 50%;
				overflow: hidden;
				image{
					width: 100%;
					height: 100%;
				}
			}
			.rightTitle{
				flex-direction: column;
				align-items: flex-start;
				width: calc(100% - 80rpx);
				padding-left: 20rpx;
				.nameBox{
					line-height: 1;
					display: flex;
					justify-content: space-between;
					.title{
						font-size: 32rpx;
						font-weight: bold;
						margin-right: 20rpx;
					}
					.item{
						margin-right: 20rpx;
						padding: 8rpx 14rpx;
						background-color: #F3F4F8;
						color: #878B8E;
						font-size: 24rpx;
					}
					.active{
						background-color: #677ECE;
						color: #FFFFFF;
					}
				}
				.priceBox{
					line-height: 1;
					margin-top: 14rpx;
					.price{
						color: #E04C1F;
						text{
							font-weight: bold;
							font-size: 36rpx;
						}
						margin-right: 10rpx;
					}
					.line{
						font-size: 18rpx;
						font-weight: 100;
						margin-right: 10rpx;
					}
					.area{
						color: #7E7F83;
						margin-right: 20rpx;
					}
					.jiedao{
						color: #7E7F83;
					}
				}
			}
		}
		.houseType{
			font-size: 30rpx;
			margin: 20rpx 0rpx;
			.price{
				margin-left: 10rpx;
			}
			.typePrice{
				color: #E04C1F;
			}
		}
		.videoImg{
			position: relative;
			height: 370rpx;
			border-radius: 10rpx;
			overflow: hidden;
			image{
				width: 100%;
				height: 100%;
			}
			.item{
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				z-index: 10;
				background-color: rgba(0,0,0,.2);
				color: #FFFFFF;
				.ipang-video{
					font-size: 107rpx;
				}
			}
		}
		.houseImg{
			height: 370rpx;
			overflow: hidden;
			background-repeat: no-repeat;
			background-position: center;
			background-size: cover;
			.ipang-vr{
				width: 150rpx;
				height: 150rpx;
				line-height: 150rpx;
				text-align: center;
				border-radius: 50%;
				background-color: rgba(0,0,0,.4);
				font-size: 80rpx;
				color: #FFFFFF;
			}
		}
	}
</style>
